package com.forenow.demo.demo16.oop;

/**
 * 方法的返回值类型以及参数
 * 1.返回值类型可以是类类型
 * 2.参数可以传对象
 *
 *
 */
public class MethodDemo {
    public void method1(Student s1){
        System.out.println(s1.getName()+"---"+s1.getAge());
    }
    public Student method2(){
        Student stu=new Student();
        stu.setName("cat");
        stu.setAge(15);
        return stu;
    }
    public String  method3(){
        String a="aaa";
        return a;
    }
    public static void main(String[] args) {
        MethodDemo methodDemo=new MethodDemo();
        Student student=methodDemo.method2();
        String a=methodDemo.method3();
        System.out.println(a);
//        System.out.println(student.getName()+"---"+student.getAge());
        /*Student s1=new Student();
        s1.setName("fender");
        s1.setAge(30);
        methodDemo.method1(s1);*/
    }
}
